import Vue from 'vue'
import Router from 'vue-router'
import Index from '@/pages/index'
import Home from '@/pages/Home'
import Singer from '@/pages/Singer'
import Myself from '@/pages/Myself'
import Search from '@/pages/Search'
import Listcate from '@/pages/Listcate'
import HotMusic from '@/pages/musicList/HotMusic'
import KingMusic from '@/pages/musicList/KingMusic'
import NewMusics from '@/pages/musicList/NewMusics'
import MoreMusic from '@/pages/MoreMusic'
import MusicPlay from '@/pages/MusicPlay'
import SongDetails from '@/pages/songdetails/SongDetails'

Vue.use(Router)

export default new Router({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes: [
    {
      path: '/musicPlay',
      name: 'musicPlay',
      component: MusicPlay
    },
    {
      path: '/',
      name: 'index',
      redirect: '/home',
      component: Index,
      children: [
        {
          path: 'home',
          name: 'home',
          component: Home,
          redirect: '/home/hotMusic',
          children: [
            {
              path: 'hotMusic',
              component: HotMusic
            },
            {
              path: 'kingMusic',
              component: KingMusic
            },
            {
              path: 'newMusics',
              component: NewMusics
            }
          ]
        },
        {
          path: 'singer',
          name: 'singer',
          component: Singer
        },
        {
          path: 'listcate',
          name: 'listcate',
          component: Listcate
        },
        {
          path: 'myself',
          name: 'myself',
          component: Myself
        },
        {
          path: 'search',
          name: 'search',
          component: Search
        },
        {
          path: 'moreMusic',
          name: 'moreMusic',
          component: MoreMusic
        },
        {
          path: '/songDetails',
          name: 'songDetails',
          component: SongDetails
        }
      ]
    }

    // {
    //   path: '/home',
    //   name: 'home',
    //   // route level code-splitting
    //   // this generates a separate chunk (about.[hash].js) for this route
    //   // which is lazy-loaded when the route is visited.
    //   component: () => import(/* webpackChunkName: "Home" */ './views/Home.vue')
    // }
  ]
})
